﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.LogEntries.PlayerRetiredLogEntry
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using Helpers;
using System.Collections.Generic;
using TaleWorlds.Localization;
using TaleWorlds.ObjectSystem;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem.LogEntries
{
  public class PlayerRetiredLogEntry : LogEntry, IEncyclopediaLog
  {
    [SaveableField(10)]
    public readonly Hero Retiree;

    internal static void AutoGeneratedStaticCollectObjectsPlayerRetiredLogEntry(
      object o,
      List<object> collectedObjects)
    {
      ((LogEntry) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      base.AutoGeneratedInstanceCollectObjects(collectedObjects);
      collectedObjects.Add((object) this.Retiree);
    }

    internal static object AutoGeneratedGetMemberValueRetiree(object o)
    {
      return (object) ((PlayerRetiredLogEntry) o).Retiree;
    }

    public PlayerRetiredLogEntry(Hero retireeHero) => this.Retiree = retireeHero;

    public override string ToString() => this.GetEncyclopediaText().ToString();

    public TextObject GetEncyclopediaText()
    {
      TextObject parent = new TextObject("{=mg0yAzIb}{RETIREE.LINK} has retired.");
      StringHelpers.SetCharacterProperties("RETIREE", this.Retiree.CharacterObject, parent);
      return parent;
    }

    public bool IsVisibleInEncyclopediaPageOf<T>(T obj) where T : MBObjectBase
    {
      return (object) obj == this.Retiree;
    }
  }
}
